<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <?php include 'inc/head.php'; ?>
  <style>
    .database a {
      font-size: small;
    }
  </style>
</head>

<body>
  <?php include 'inc/header.php'; ?>

  <div class="container">
    <!-- content start -->

    <div class="card">
      <div class="card-header">数据库管理</div>
      <div class="card-body">
        <div class="btn-group btn-group-sm">
          <a href="<?php echo M('admin', 'database', 'backup') ?>" class="btn btn-primary">备份</a>
          <a href="<?php echo M('admin', 'database', 'optimize') ?>" class="btn btn-primary">优化</a>
          <a href="javascript:if(confirm('数据正常的情况下，请不要随意进行修复操作！\n您确定要进行该操作吗？')) window.location.href='<?php echo M('admin', 'database', 'repair') ?>';" class="btn btn-primary">修复</a>
          <a href="<?php echo M('admin', 'database', 'databak') ?>" class="btn btn-primary">管理</a>
        </div>
        <hr>
        <div class="row">
          <?php
          $res = $this->dbc->tables();
          if (!empty($res)) {
            $count = count($res);
            for ($i = 0; $i < $count; $i++) {
              $name = str_replace(DATA_PREFIX, '', $res[$i]);
              echo strpos($res[$i], DATA_PREFIX) !== FALSE ? '<a href="' . M('admin', 'database', 'table', $res[$i]) . '" class="col-6 col-sm-3" title="点击查看表结构">' . $name . '</a>' : '';
            }
          }
          ?>
        </div>
      </div>
    </div>

    <!-- content end -->
  </div>

  <?php include 'inc/footer.php'; ?>

</body>

</html>